﻿using ReflectionStudio.Core.Events;
using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
using System.Linq;
using WPFExcelReport.Helpers;
using System.Windows.Input;
using System.Windows.Controls;
namespace WPFExcelReport
{
    /// <summary>
    /// 专用于坯布检验
    /// 1.扫描布卷号，进入验布，读取生产单信息
    /// 2.输入长度，修改数据库记录
    /// 3.剪出新布卷
    /// 4.打印标签
    /// 5.疵点保存修正
    /// 6.事件记录
    /// 7.纬纱扣除
    /// 8.织轴扣除
    /// </summary>
    public partial class TFUBTWB19X
    { 
        public TFUBTWB19X()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VWBFEHL();
            this.DataContext = MV;
            InitializeComponent();
        }
         //处理长疵点以及并行多个长疵点
         //对于并行长疵点，采用手工更改起始位置的方式
        public override void OnEKEYChg()
        {
            if (EKEY == "")
                return;
            base.OnEKEYChg();
            string lg = EKEY.Substring(10, 2);
            if (lg == "01")
            {
                if (IsLengStart == false)
                {
                    IsLengStart = true;
                }
                else
                {
                    IsLengStart = false;
                    EndError(null, null);
                    if (IsCanNew)
                    { 
                        NewCommand(null, null);
                    }   
                }
            }
            else
            {
                IsLengStart = false;
                EndError(null, null);
                 if (IsCanNew)
                { 
                    NewCommand(null, null);
                }
            }
            TTPOINTS = TMV.SUM1;
            SetUpChart();
        }
        public override void OnHPOSITIONChg(string value)
        {
            if (value == "")
                return;
            TMV.WBFBRTVON =double.Parse( value.Substring(0, 10));
            TMV.WBFBRTBIS = double.Parse(value.Substring(0, 10));
            base.OnHPOSITIONChg(value);
        }
    }
}
